<?php
class Msg_model extends MY_Model {

    function __construct(){
        parent::__construct();
    }
    
    function get_by_page($fromnum,$loginer_id){
        $where = array();
        $where['msg.to_id'] = $loginer_id;
        
        $this->db->select('msg.id')
    		->from('msg')
    		->where($where);
        $this->count = $this->db->count_all_results();
        $this->db->select('msg.*,m.nname as postername,m.email as posteremail')
    		->from('msg')
    		->join('member m','m.id=msg.from_id','left')
    		->order_by('msg.atime desc')
    		->where($where);
    	$query = $this->db->limit(PAGESIZE,$fromnum)->get();
    	$list = $query->result();
    	return $list; 
    }
    
    
}